package Text3;

import java.util.Scanner;

/*
 *@Student 张策
 */
public class Work2 {
    public static void f1(){
        Scanner scanner=new Scanner(System.in);

        panduan("zc","1234j6","@a.s");
    }
    public static void panduan(String name,String mima,String yx){
        if(!(name.length()>1&&name.length()<5)){
            throw new RuntimeException("名字长度不规范");
        }
        if(mima.length()!=6){
            throw new RuntimeException("密码长度不对");
        }
//        try {Integer i=new Integer(mima);}catch(Exception e){
//            throw new RuntimeException("密码形式错误");
//        }
        if (mimageshi(mima)) {
            throw new RuntimeException("密码形式错误");
        }
        if(yxpd(yx)){
            throw new RuntimeException("邮箱不正确");
        }
    }
    public static boolean mimageshi(String mima){

        for (int i=0;i<mima.length();i++) {
            if(!(Character.isDigit(mima.charAt(i))))
            {
                return true;
            }
        }
        return false;
    }
    public static boolean yxpd(String yx){
        StringBuilder stringBuilder=new StringBuilder(yx);
        int i1 = stringBuilder.indexOf("@");
        int i2 = stringBuilder.indexOf(".");
        if (!((i1 !=-1&& i2 !=-1)|| i1 > i2)) {
            return true;
        }
        return false;
    }
    public static void main(String[] args) {
        try {
            f1();
            System.out.println("注册成功");
        } catch (Exception e) {
//            e.printStackTrace();
            System.out.println(e.getMessage());
        }
    }
}
